/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package info.touret.winecellar.reminder;

import info.touret.winecellar.userinfo.server.domain.UserInfo;

import org.apache.log4j.Logger;

import com.google.gdata.client.calendar.CalendarService;
import com.google.inject.Inject;


/**
 *
 * @author touret-a
 */
public class GAECalendarServiceFactory implements CalendarServiceFactory {

	private static final Logger trace = Logger
	.getLogger(LocalCalendarServiceFactory.class);

    @Inject
    private UserInfo user;

    @Override
    public CalendarService get() {
        CalendarService myService = new CalendarService(CalendarService.CALENDAR_SERVICE);
        trace.debug("USER=" + user.toString());
        myService.setAuthSubToken(user.getGdatatoken(), null);
        return myService;
    }
}
